/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cn.g31010.sip.util;

import cn.g31010.sip.pojo.User;
import cn.g31010.sip.service.AuthService;
import cn.g31010.sip.service.UserManageService;

import com.caucho.hessian.client.HessianProxyFactory;

/**
 *
 * @author qingfeng.gao
 */
public class HessianClient {

    public static void main(String args[]) throws Exception {
    	auth();
    }
    
    public static void auth() throws Exception{
    	String url = "http://appserver.31010.cn/openvchat/auth";
    	HessianProxyFactory factory = new HessianProxyFactory();
    	final AuthService basic = (AuthService) factory.create(AuthService.class, url);
    	System.out.println(basic.auth("111", "111"));
    }
    
    public static void addUser() throws Exception{
    	String url = "http://appserver.31010.cn/openvchat/user";
    	HessianProxyFactory factory = new HessianProxyFactory();
    	final UserManageService basic = (UserManageService) factory.create(UserManageService.class, url);
    	User user = new User();
    	user.setId("UID00001");
    	user.setName("111");
    	user.setNickName("111");
    	user.setPasswd("111");
    	User u = basic.addUser(user);
    	System.out.println(u);
    }
}
